import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import './index.scss'
import avatar from '@/assets/icon/buy-avatar.png'

interface IProps {
  list: any
  showMore: boolean
}

export default class AvatarList extends Component<IProps, {}> {
  props: any

  static options = {
    addGlobalClass: true
  }

  render() {
    const { list=[], showMore } = this.props
    const arr = [ 0, 1, 2, 3, 4 ]
    const prefixCls = 'avatar-list'
    return (<View className={prefixCls}>
      {arr.map((_i, k) => {
        return <Image key={k} src={list[k] ? list[k] : avatar} lazyLoad className={`${prefixCls}__item`}/>
      })}
      {showMore && <View className={`${prefixCls}__item ${prefixCls}__more f-g-5 bnn-icon`}>&#xe73a;</View>}
    </View>)
  }
}
